<h1 class="title"><% if params[:id] == 'closed'%> Closed project list<% else %>Project list<% end %></h1>

<table class="tabular">
 <tr class="header">
  <th>Name</th>
  <th>Client</th>
  <th>New</th>
  <th>Open</th>
  <th>Stalled</th>
  <th>Actions</th>
 </tr>
<% odd = 1 %> 
<% for project in @projects %>
 <tr <% if odd == 1 %>class="odd_row"<% odd = 0 %><% else %>class="even_row"<% odd = 1 %><% end %>>
  <td><%= link_to project.name, { :controller => "project", :action => "show", :id => project.project_id }  %></td>
  <td><%= project.client_name %></td>
    <% statistics = project.task_statistics %>
  <td><%= statistics[:new] %></td>
  <td><%= statistics[:opened]  %></td>
  <td><%= statistics[:stalled] %></td>
  <td>
  <% if session[:user].rights != 'ManageTasks' %>
      <%= link_to "Edit", { :controller => 'project', :action => 'edit', :id => project.project_id } %> |
  <% end %>
  <%= link_to "Add task", { :controller => 'task', :action => 'add', :id => project.project_id } %> |
  <%= link_to "Tasks", { :controller => 'project', :action => 'tasks', :id => project.project_id } %>
  </td>
 </tr> 
<% end %>
</table> 
